package com.party.mobile.web.dto.photo.input;

import com.google.common.collect.Lists;
import org.hibernate.validator.constraints.NotBlank;

import java.io.Serializable;
import java.util.List;

/**
 * @Description: 图片上传输入
 * @Author: yangshoukun
 * @Date: 2018/6/5 13:41
 */
public class ImgUploadInput implements Serializable {

    private static final long serialVersionUID = 8631101770942024820L;
    // 图片相册id
    @NotBlank(message = "相册id不能为空")
    private String photosId;
    // 图片分类id
    @NotBlank(message = "图片分类id不能为空")
    private String tagId;
    // 图片上传
    private List<ImgInput> imgs = Lists.newArrayList();

    // 上传图片的原始imgs
    private String imgStrs;

    public String getImgStrs() {
        return imgStrs;
    }

    public void setImgStrs(String imgStrs) {
        this.imgStrs = imgStrs;
    }

    public String getPhotosId() {
        return photosId;
    }

    public void setPhotosId(String photosId) {
        this.photosId = photosId;
    }

    public String getTagId() {
        return tagId;
    }

    public void setTagId(String tagId) {
        this.tagId = tagId;
    }

    public List<ImgInput> getImgs() {
        return imgs;
    }

    public void setImgs(List<ImgInput> imgs) {
        this.imgs = imgs;
    }

    @Override
    public String toString() {
        return "ImgUploadInput{" +
                "photosId='" + photosId + '\'' +
                ", tagId='" + tagId + '\'' +
                ", imgs=" + imgs +
                ", imgStrs='" + imgStrs + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ImgUploadInput)) return false;

        ImgUploadInput that = (ImgUploadInput) o;

        if (photosId != null ? !photosId.equals(that.photosId) : that.photosId != null) return false;
        if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) return false;
        if (imgs != null ? !imgs.equals(that.imgs) : that.imgs != null) return false;
        return imgStrs != null ? imgStrs.equals(that.imgStrs) : that.imgStrs == null;
    }

    @Override
    public int hashCode() {
        int result = photosId != null ? photosId.hashCode() : 0;
        result = 31 * result + (tagId != null ? tagId.hashCode() : 0);
        result = 31 * result + (imgs != null ? imgs.hashCode() : 0);
        result = 31 * result + (imgStrs != null ? imgStrs.hashCode() : 0);
        return result;
    }

    public class ImgInput {
        // 上传的图片的图片表id
        private String resourceId;
        // 图片路径
        private String url;

        private String path;

        public String getResourceId() {
            return resourceId;
        }

        public void setResourceId(String resourceId) {
            this.resourceId = resourceId;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }
    }
}
